#include "stm32f10x.h"
#include "board.h"
#include "kservice.h"

#define I2C1_SLAVE_ADDRESS7    0xA0

#define I2C_PageSize           256

#define FRAM_I2C_SCL_RCC   			RCC_APB2Periph_GPIOA
#define FRAM_I2C_SCL_PIN	  		GPIO_Pin_0
#define FRAM_I2C_SCL_PORT				GPIOA

#define FRAM_I2C_SDA_RCC   			RCC_APB2Periph_GPIOA
#define FRAM_I2C_SDA_PIN	  		GPIO_Pin_1
#define FRAM_I2C_SDA_PORT				GPIOA

#define SCL_H         GPIO_SetBits(FRAM_I2C_SCL_PORT, FRAM_I2C_SCL_PIN)
#define SCL_L         GPIO_ResetBits(FRAM_I2C_SCL_PORT, FRAM_I2C_SCL_PIN)
   
#define SDA_H         GPIO_SetBits(FRAM_I2C_SDA_PORT, FRAM_I2C_SDA_PIN) 
#define SDA_L         GPIO_ResetBits(FRAM_I2C_SDA_PORT, FRAM_I2C_SDA_PIN) 

#define SCL_read      GPIO_ReadInputDataBit(FRAM_I2C_SCL_PORT, FRAM_I2C_SCL_PIN)
#define SDA_read      GPIO_ReadInputDataBit(FRAM_I2C_SDA_PORT, FRAM_I2C_SDA_PIN)

unsigned char fram_write(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite);
unsigned char fram_read(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteToRead);
void fram_init_i2c(void);


